<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.cinema.data.Adminusr" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory,
	com.google.appengine.api.blobstore.BlobstoreService" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta HTTP-EQUIV="Pragma" content="no-cache">
<meta HTTP-EQUIV="Expires" content="-1"> 
<title>Đồ Án Môn Học</title>
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
<script type="text/javascript">
function fileFields() {
	var div1 = document.createElement('div'); 
	div1.innerHTML = document.getElementById('newlinktpl').innerHTML;
	document.getElementById('addmore').appendChild(div1);  
}
</script>
<script type="text/javascript" src="js/calendarDateInput.js">
</script>
</head>
<body>
<%
	Adminusr user = (Adminusr)session.getAttribute("adminuser");
	if(user == null)
		response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unauthorized Access");
	boolean isAdmin = false;
	if(user.getGroupid() == 1)//Admin
		isAdmin = true;
	else//not admin
		response.sendRedirect("/ticket?pageid=1");
	BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>
<!-- Start: page-top-outer -->
<div id="page-top-outer">    

<!-- Start: page-top -->
	<div id="page-top">
		<div class="clear"></div>
	</div>
<!-- End: page-top -->

</div>
<!-- End: page-top-outer -->
	
<div class="clear">&nbsp;</div>
 
<!--  start nav-outer-repeat................................................................................................. START -->
<div class="nav-outer-repeat"> 
<!--  start nav-outer -->
	<div class="nav-outer"> 
			<!--  start nav -->
			<div class="nav">
				<div class="table">
				<div class="nav-divider">&nbsp;</div>
<%
				if(isAdmin){
%>			
									
					<ul class="current">

						<li><a href="cp.jsp"><b>Movie</b></a>
							<div class="select_sub show">
								<ul class="sub">									
									<li class="sub_show"><a href="cp.jsp">Add Movie</a></li>
									<li><a href="/ticket?pageid=2">Delete Movie</a></li>
									<li><a href="/ticket?pageid=1">Ticket</a></li>
								</ul>
							</div>
						</li>
					</ul>
					
					<div class="nav-divider">&nbsp;</div>
					
					<ul class="select">
						<li><a href="viewpage?id=1"><b>User Mangement</b></a>
						<div class="select_sub">
							<ul class="sub">
								<li><a href="viewpage?id=1">User List</a></li>
								<li><a href="viewpage?id=2">Add user</a></li>
								<li><a href="viewpage?id=3">Remove user</a></li>
							</ul>
						</div>
						</li>
					</ul>
<%
				}else{
%>
					<ul class="current">

						<li><a href="/ticket?pageid=1"><b>Movie</b></a>
							<div class="select_sub show">
								<ul class="sub">									
									<li class="sub_show"><a href="/ticket?pageid=1">Ticket</a></li>
								</ul>
							</div>
						</li>
					</ul>				
<%
				}
%>
					<div class="nav-divider">&nbsp;</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
			<!--  start nav -->

	</div>
	<div class="clear"></div>
<!--  start nav-outer -->
</div>
<!--  start nav-outer-repeat................................................... END -->
 
 <div class="clear"></div>
 
<!-- start content-outer -->
<div id="content-outer">
<!-- start content -->
	<div id="content">


		<div id="page-heading"><h1>Add Phim</h1></div>

			<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
				<tr>
					<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
					<th class="topleft"></th>
					<td id="tbl-border-top">&nbsp;</td>
					<th class="topright"></th>
					<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
				</tr>
				<tr>
					<td id="tbl-border-left"></td>
					<td>
				<!--  start content-table-inner -->
						<div id="content-table-inner">
				<form action="<%= blobstoreService.createUploadUrl("/addFilm") %>" method="post" enctype="multipart/form-data">
							<table border="0" width="100%" cellpadding="0" cellspacing="0">
								<tr valign="top">
									<td>	
										<!--  start step-holder -->
										<div id="step-holder">
											<div class="step-dark-left"><a href="">Thêm Chi tiết Phim</a></div>
											<div class="step-dark-right">&nbsp;</div>

											<div class="clear"></div>
										</div>
										<!--  end step-holder -->
					
										<!-- start id-form -->
										<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
											<tr>
												<th valign="top">Tên Phim:</th>
												<td><input name="filmname" type="text" class="inp-form" /></td>
												<td></td>
											</tr>
											<tr>
												<th valign="top">Trailer:</th>
												<td><input name="trailerlink" type="text" class="inp-form" /></td>
											</tr>
											<tr>
												<th valign="top">Image:</th>
												<td><input name="imgLink" type="file" class="inp-form" /></td>
											</tr>
											<tr>
												<th valign="top">Rating:</th>
												<td><input name="rating" type="text" class="inp-form" /></td>
											</tr>
											<tr>
												<th valign="top">Thông tin ngắn gọn:</th>
												<td><textarea name="shortInfo" rows="" cols="" class="form-textarea"></textarea></td>
											</tr>
											<tr>
												<th valign="top">Mô tả:</th>
												<td><textarea name="description" rows="" cols="" class="form-textarea"></textarea></td>
											</tr>
											<tr>
												<th valign="top">Từ ngày:</th>
												<td><input type="text" name="fromday" class="inp-form" /></td>
											</tr>
											<tr>
												<th valign="top">Đến ngày:</th>
												<td><input type="text" name="today" class="inp-form" /></td>
											</tr>
											<tr>
												<th>Ngày chiếu:</th>
												<td>
													<div id="addmore">
														<input type="text" name="schedule" class="inp-form" />
													</div>
												</td>
											</tr>
											<tr>
												<td>&nbsp;</td>
												<td><input type="button" onclick="fileFields()" value="Add more day" /></td>
											</tr>
										</table>
										<!-- end id-form  -->
									</td>
								</tr>								
								<tr>
									<td><input type="submit" id="ftp-submit" class="button" value="Thêm Phim" /></td>
								</tr>
							</table>
							</form>
							<div class="clear"></div>
						</div>
						<!--  end content-table-inner  -->
					</td>
					<td id="tbl-border-right"></td>
				</tr>
				<tr>
					<th class="sized bottomleft"></th>
					<td id="tbl-border-bottom">&nbsp;</td>
					<th class="sized bottomright"></th>
				</tr>
			</table>
	</div>
</div>

<div id="newlinktpl" style="display:none">  
	<input type="text" name="schedule" class="inp-form" />  
</div> 

</body>
</html>